home *** CD-ROM | disk | FTP | other *** search
/ Dynamic HTML Construction Kit / Dynamic HTML Construction Kit.iso / earthlink / nscomm / java40.jar / java / awt / Frame.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-11-03  |  3.1 KB  |  171 lines

  1. package java.awt;
  2.  
  3. import java.awt.peer.FramePeer;
  4.  
  5. public class Frame extends Window implements MenuContainer {
  6.    public static final int DEFAULT_CURSOR = 0;
  7.    public static final int CROSSHAIR_CURSOR = 1;
  8.    public static final int TEXT_CURSOR = 2;
  9.    public static final int WAIT_CURSOR = 3;
  10.    public static final int SW_RESIZE_CURSOR = 4;
  11.    public static final int SE_RESIZE_CURSOR = 5;
  12.    public static final int NW_RESIZE_CURSOR = 6;
  13.    public static final int NE_RESIZE_CURSOR = 7;
  14.    public static final int N_RESIZE_CURSOR = 8;
  15.    public static final int S_RESIZE_CURSOR = 9;
  16.    public static final int W_RESIZE_CURSOR = 10;
  17.    public static final int E_RESIZE_CURSOR = 11;
  18.    public static final int HAND_CURSOR = 12;
  19.    public static final int MOVE_CURSOR = 13;
  20.    String title;
  21.    Image icon;
  22.    MenuBar menuBar;
  23.    boolean resizable;
  24.    Image cursorImage;
  25.    int cursorType;
  26.    Color cursorFg;
  27.    Color cursorBg;
  28.  
  29.    public Frame() {
  30.       this.title = "Untitled";
  31.       this.resizable = true;
  32.       this.cursorType = 0;
  33.       super.visible = false;
  34.       ((Container)this).setLayout(new BorderLayout());
  35.    }
  36.  
  37.    public Frame(String var1) {
  38.       this();
  39.       this.title = var1;
  40.    }
  41.  
  42.    public synchronized void addNotify() {
  43.       if (super.peer == null) {
  44.          super.peer = ((Window)this).getToolkit().createFrame(this);
  45.       }
  46.  
  47.       if (this.menuBar != null) {
  48.          this.menuBar.addNotify();
  49.          ((FramePeer)super.peer).setMenuBar(this.menuBar);
  50.       }
  51.  
  52.       super.addNotify();
  53.    }
  54.  
  55.    public String getTitle() {
  56.       return this.title;
  57.    }
  58.  
  59.    public void setTitle(String var1) {
  60.       this.title = var1;
  61.       FramePeer var2 = (FramePeer)super.peer;
  62.       if (var2 != null) {
  63.          var2.setTitle(var1);
  64.       }
  65.  
  66.    }
  67.  
  68.    public Image getIconImage() {
  69.       return this.icon;
  70.    }
  71.  
  72.    public void setIconImage(Image var1) {
  73.       this.icon = var1;
  74.       FramePeer var2 = (FramePeer)super.peer;
  75.       if (var2 != null) {
  76.          var2.setIconImage(var1);
  77.       }
  78.  
  79.    }
  80.  
  81.    public MenuBar getMenuBar() {
  82.       return this.menuBar;
  83.    }
  84.  
  85.    public synchronized void setMenuBar(MenuBar var1) {
  86.       if (this.menuBar != var1) {
  87.          if (var1.parent != null) {
  88.             var1.parent.remove(var1);
  89.          }
  90.  
  91.          if (this.menuBar != null) {
  92.             this.remove(this.menuBar);
  93.          }
  94.  
  95.          this.menuBar = var1;
  96.          this.menuBar.parent = this;
  97.          FramePeer var2 = (FramePeer)super.peer;
  98.          if (var2 != null) {
  99.             this.menuBar.addNotify();
  100.             var2.setMenuBar(this.menuBar);
  101.          }
  102.  
  103.       }
  104.    }
  105.  
  106.    public synchronized void remove(MenuComponent var1) {
  107.       if (var1 == this.menuBar) {
  108.          FramePeer var2 = (FramePeer)super.peer;
  109.          if (var2 != null) {
  110.             this.menuBar.removeNotify();
  111.             this.menuBar.parent = null;
  112.             var2.setMenuBar((MenuBar)null);
  113.          }
  114.  
  115.          this.menuBar = null;
  116.       }
  117.  
  118.    }
  119.  
  120.    public synchronized void dispose() {
  121.       if (this.menuBar != null) {
  122.          this.remove(this.menuBar);
  123.          this.menuBar = null;
  124.       }
  125.  
  126.       super.dispose();
  127.    }
  128.  
  129.    public boolean isResizable() {
  130.       return this.resizable;
  131.    }
  132.  
  133.    public void setResizable(boolean var1) {
  134.       this.resizable = var1;
  135.       FramePeer var2 = (FramePeer)super.peer;
  136.       if (var2 != null) {
  137.          var2.setResizable(var1);
  138.       }
  139.  
  140.    }
  141.  
  142.    public void setCursor(int var1) {
  143.       if (var1 >= 0 && var1 <= 13) {
  144.          this.cursorType = var1;
  145.          if (super.peer != null) {
  146.             ((FramePeer)super.peer).setCursor(var1);
  147.          }
  148.  
  149.       } else {
  150.          throw new IllegalArgumentException("illegal cursor type");
  151.       }
  152.    }
  153.  
  154.    public int getCursorType() {
  155.       return this.cursorType;
  156.    }
  157.  
  158.    protected String paramString() {
  159.       String var1 = super.paramString();
  160.       if (this.resizable) {
  161.          var1 = var1 + ",resizable";
  162.       }
  163.  
  164.       if (this.title != null) {
  165.          var1 = var1 + ",title=" + this.title;
  166.       }
  167.  
  168.       return var1;
  169.    }
  170. }
  171.